Developer Documentation

QuickTime 4 API Documentation

3D Graphics Programming with QuickDraw 3D 1.5.4

Previous | QD3D Book | Overview | Chapter Contents | Next |

Accessing Private Data

You may access private data at any time in a class or object with the routines described in this section.

Q3XObjectClass_GetPrivate

You can use the Q3XObjectClass_GetPrivate routine to get the private instance data of an object.

void *Q3XObjectClass_GetPrivate(
                     TQ3XObjectClass    objectClass,
                     TQ3Object          targetObject);
objectClass
A class.
targetObject
An object
return value
The class's private data block.

DESCRIPTION

The Q3XObjectClass_GetPrivate routine returns a pointer to a block of instanceSize bytes (where instanceSize is from the objectClass class's previous Q3XObjectHierarchy_RegisterClass call) that contains the private instance data of targetObject. Q3XObjectClass_GetPrivate returns NULL if instanceSize was 0.

The Q3XObjectClass_GetPrivate routine may return NULL if an invalid object or object of the wrong type is passed in, if instanceSize or classSize is 0 in the previous Q3ObjectHierarchy_Register call, or if an invalid target is passed in.

EXAMPLE

TQ3Status Q3FooGroup_SetDummy(
    TQ3GroupObject          group,
    float                   dummy)
{
    TFooGroupPrivate *gPriv;
    gPriv = Q3XObjectClass_GetPrivate(
            gFooGroupClass,
            group);
    if (gPriv == NULL)
        return kQ3Failure;
    gPriv->dummy = dummy;
    return Q3Shared_Edited(group);
}

Q3XObject_GetClassPrivate

You can use the Q3XObject_GetClassPrivate routine to get private class data from an object.

void *Q3XObject_GetClassPrivate(
                     TQ3XObjectClass    objectClass,
                     TQ3Object          targetObject);
objectClass
A class.
targetObject
An object
return value
The class's private data block.

DESCRIPTION

The Q3XObject_GetClassPrivate routine returns a pointer to a block of instanceSize bytes (where instanceSize is from the objectClass class's previous Q3XObjectHierarchy_RegisterClass call) that contains the private class data of targetObject. If instanceSize was 0, Q3XObject_GetClassPrivate returns NULL .

The Q3XObject_GetClassPrivate routine may return NULL if an invalid object or object of the wrong type is passed in, if instanceSize or classSize is 0 in the previous Q3ObjectHierarchy_Register call, or if an invalid target is passed in.

Q3XObjectClass_GetClassPrivate

You can use the Q3XObjectClass_GetClassPrivate routine to get private class data from a class.

void *Q3XObjectClass_GetClassPrivate(
                     TQ3XObjectClass    objectClass,
                     TQ3XObjectClass    targetObjectClass);
objectClass
A class.
targetObjectClass
A class.
return value
The target class's private data block.

DESCRIPTION

The Q3XObjectClass_GetClassPrivate routine returns a pointer to a block of instanceSize bytes (where instanceSize is from the objectClass class's previous Q3XObjectHierarchy_RegisterClass call) that contains the private data of targetObject. If instanceSize was 0, Q3XObjectClass_GetClassPrivate returns NULL .

The Q3XObjectClass_GetClassPrivate routine may return NULL if an invalid object or object of the wrong type is passed in, if instanceSize or classSize is 0 in the previous Q3ObjectHierarchy_Register call, or if an invalid target is passed in.


© 1997 Apple Computer, Inc.

Previous | QD3D Book | Overview | Chapter Contents | Next |